package ${basePackage}.cli.command;

import cn.hutool.core.bean.BeanUtil;
import ${basePackage}.generator.file.FileGenerator;
import ${basePackage}.model.MainTemplateModel;
import lombok.Data;
import picocli.CommandLine;
import picocli.CommandLine.Command;
import picocli.CommandLine.Option;

import java.util.concurrent.Callable;

/**
 * @author ${author}
 * @verison ${version}
 */

@Data
@Command(name = "generate", description = "配置参数", mixinStandardHelpOptions = true)
public class GenerateCommand implements Callable {


<#list modelConfig.models as modelInfo>
    @Option(names = {"--${modelInfo.fieldName}", <#if modelInfo.abbr??>"--${modelInfo.abbr}" </#if>}, description = "${modelInfo.description}", arity = "0..1", interactive = true, echo = true)
    private ${modelInfo.type} ${modelInfo.fieldName} <#if modelInfo.defaultValue?? && modelInfo.type=="boolean"> = ${ modelInfo.defaultValue?c} </#if>;

</#list>

    @Override
    public Object call() throws Exception {
        MainTemplateModel mainTemplateModel = new MainTemplateModel();
        BeanUtil.copyProperties(this, mainTemplateModel);
        System.out.println("配置信息" + mainTemplateModel);
        FileGenerator.doGen(mainTemplateModel);
        return null;
    }
}
